﻿$(document).ready(function () {

    //Tabs function
    $("#tabs").tabs();
    $("#tabss").tabs();

    //Content language selection
    $("#contlangsel").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangsel").change(function () {
        $(location).attr('href', "/Home/LanguageFront/" + $(this).attr("value"));
    });
    //Content language selection for articles
    $("#contlangselA").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangselA").change(function () {
        $(location).attr('href', "/Content/LanguageArticles/" + $(this).attr("value"));
    });
    //Content language selection for papers
    $("#contlangselP").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangselP").change(function () {
        $(location).attr('href', "/Content/LanguagePapers/" + $(this).attr("value"));
    });
    //Content language selection for news
    $("#contlangselN").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangselN").change(function () {
        $(location).attr('href', "/Content/LanguageNews/" + $(this).attr("value"));
    });
    //Content language selection for researches
    $("#contlangselR").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangselR").change(function () {
        $(location).attr('href', "/Content/LanguageResearches/" + $(this).attr("value"));
    });
    //Content language selection for RR
    $("#contlangselRR").sb({ optionFormat: function () {
        return $(this).attr("title");
    }
    });
    $("#contlangselRR").change(function () {
        $(location).attr('href', "/Content/LanguageRR/" + $(this).attr("value"));
    });

    //Timeline
    $('#gallerya a.timeline').lightBox({ fixedNavigation: true });

    $(".timeline").hover(function () {
        var id = $(this).attr('id').split('-')[1];
        var item = List["info-" + id];

        $("#image-container").html('<a href="' + item.FullPath + '" title="' + item.PictureData + '"><img src="' + item.ThumbPath + '" /></a><br /><strong>' + item.PictureData + '</strong>');

        /* We have to have it here as well since it'll deregister the event handler when we fill the image-container with new content */
        $('#gallerya a .timeline').lightBox({ fixedNavigation: true });
    });
}); 